<?php 
defined('_JEXEC') or die;

// disable core styles to avoid bs conflict 
OC_Util::$core_styles = array();

$keyword = JRequest::getString('q', '');
?>

<div class="dialogp_content">
   <div class="searchaction">
      <span class="medium">搜索：</span>
      <div class="dialogsearchbg clearfix">
         <input type="text" value="<?=$keyword?>" class="pull-left search_input"/>
         <a href="<?=(OC_Helper::linkToRoute('resumes_taglist') . '?q=%q')?>" class="pull-right search_btn"></a>
      </div>
   </div>
   
   <?php if(count($_['tagikeylist']) >= 2): ?>
   <div class="selectletter medium">
      <?php 
      list($href, $selected) = PResumesHelper::getSearchItemHref($_['ikeyPageUrl'], 'ik', 'all');
      ?>
      <a href="<?=($selected ? 'javascript:;' : $href)?>" class="displaylist <?=($selected ? 'cur_a'  : '')?>">全部</a>
      <?php 
      if(isset($_['tagikeylist']) && !empty($_['tagikeylist'])) {
         foreach ($_['tagikeylist'] as $tagikey) {
            list($href, $selected) = PResumesHelper::getSearchItemHref($_['ikeyPageUrl'], 'ik', $tagikey);
      ?>
      <a href="<?=($selected ? 'javascript:;' : $href)?>" class="displaylist <?=($selected ? 'cur_a'  : '')?>"><?=strtoupper($tagikey == 'other' ? '其他' : $tagikey)?></a>
      <?php 
         }
      }
      ?>
   </div>
   <?php endif; ?>
   
   <div class="itemlist">
   <?php if (empty($_['tagList'])): ?>
   <div class="postionlisttable_nodata large yahei" style="text-align: center;">没有对应的标签</div>
   <?php else: ?>
   <div class="postionlisttable medium">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
         <tr>
            <?php 
            $n=count($_['tagList']);
            for ($i=0; $i < $n; $i++) {
               $tag = $_['tagList'][$i];
               if ($i != 0 && ($i%3) == 0) {
                  echo '</tr><tr>';
               }
               list($href, $selected) = PResumesHelper::getSearchItemHref($_['searchUrl'], 'tag', $tag['name']);
            ?>
            <td width="33%"><a href="<?=($selected ? 'javascript:;' : $href)?>" class="link <?=($selected ? 'cur_a'  : '')?>"><?=$tag['name']?></a></td>
            <?php 
            }
            
            $filledNum = 3 - ($n%3);
            if ($filledNum < 3) {
               for ($i=0; $i < $filledNum; $i++) {
                  echo '<td width="33%"></td>';
               }
            }
            ?>
         </tr>
      </table>
   </div>
   <?php endif; ?>
   </div>
</div>